<template>
	<view class="multiple_product_box" >
		<view class="multiple_product_content">
			<view v-for="(item, index) in data">
				<view class="product-pic" v-if="index <= 2">
					<image :src="item.thumPic" mode="scaleToFill"></image>
					<view class="product_tag">
						<text v-if="item.openStatus3">{{item.openStatus3}}</text>
						<text v-if="item.oneBuyPromotionVO && k.oneBuyPromotionVO.id">新人专享</text>
					</view>
					<view class="product_count">x{{item.amount}}</view>
				</view>
			</view>
		</view>
		<view class="lf lf-center">
			<text>共{{goodsCount || 0}}件</text>
			<image class="product_icon" src="" mode=""></image>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			data: {
				type: Array,
				default() {
					return []
				}
			}
		},
		computed: {
			// 商品总数
			goodsCount() {
				return this.data.reduce((accu, item) => {
					return accu += Number(item.amount || 0)
				}, 0)
			}
		},
	}
</script>

<style lang="scss" scoped>
	.multiple_product_box {
		display: flex;
		justify-content: space-between;
		align-items: center;
		
		.multiple_product_content {
			display:grid;
			grid-template-columns: repeat(3,1fr);
			grid-column-gap: 10rpx;
			align-content: center;
			color: #1b2120;
		}
		
		.product_icon {
			margin-left: 8rpx;
			width: 12rpx;
			height: 20rpx;
		}
	}
	
	.product-pic {
		flex: 1;
		width: 160rpx;
		height: 160rpx;
		border-radius: 12rpx;
		overflow: hidden;
		position: relative;
	
		image {
			width: 160rpx;
			height: 160rpx;
		}
	
		.product_tag {
			height: 32rpx;
			position: absolute;
			left: 8rpx;
			top: 8rpx;
			font-size: 24rpx;
			color: #C08E0B;
			background-color: #FFFFFF;
			border-radius: 4rpx;
			line-height: 32rpx;
			text-align: center;
			padding: 4rpx;
		}
		
		.product_count {
			position: absolute;
			width: 46rpx;
			height: 34rpx;
			right: 0px;
			bottom: 0px;
			border-radius: 24rpx 0px 0px 0px;
			background: rgba(0, 0, 0, 0.35);
			color: #FFFFFF;
			font-size: 20rpx;
			line-height: 34rpx;
			text-align: center;
		}
		
	}
</style>